<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>扩展运算符</title>
</head>
<body>
<p>拓展运算符(...)用于取出参数对象所有可遍历属性然后拷贝到当前对象</p>
<script>
    let user = {name:"王贺",age:18};
    //对象复制
    let wanghe = {...user};
    console.log(wanghe);

    //对象合并
    let hobby ="唱跳rap篮球";
    let wanghe2 = {...user,hobby,address:"郑州"};
    console.log(wanghe2);

    //...还可以和解构数组组合属性
    let arr=[1,2,3,4,5];
    let [x,y,...z]=arr;
    console.log(x,y,z);
</script>
</body>
</html>